package two_pointer;

/**
 * Created with IntelliJ IDEA.
 * Description: 344. 反转字符串
 * User: Li_yizYa
 * Date: 2025/5/12
 * Time: 21:06
 */
public class Solution2 {
    public void reverseString(char[] s) {
        if (s == null || s.length == 0) {
            return;
        }
        int left = 0;
        int right = s.length - 1;
        while (left < right) {
            char tmp = s[left];
            s[left] = s[right];
            s[right] = tmp;
            left++;
            right--;
        }
    }
}
